file chooser: Use the right model when getting the selection
authorMatthias Clasen <mclasen@redhat.com>
Sat, 13 Feb 2016 01:35:26 +0000 (20:35 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 13 Feb 2016 01:35:26 +0000 (20:35 -0500)
We don't need to make assumptions about which model is currently
used since gtk_tree_selection_get_selection hands us the model.

https://bugzilla.gnome.org/show_bug.cgi?id=761757

gtk/gtkfilechooserwidget.c

index c77a8b7b96a81f2d7d230e98cac802a4688391a6..6ef25b6cf50ec41e5955dc9304204f3661d5acd0 100644 (file)
@@ -6266,10 +6266,11 @@ get_selected_file_info_from_file_list (GtkFileChooserWidget *impl,
   GtkTreeSelection *selection;
   GtkTreeIter iter;
   GFileInfo *info;
+  GtkTreeModel *model;
 
   g_assert (!priv->select_multiple);
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
-  if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
+  if (!gtk_tree_selection_get_selected (selection, &model, &iter))
     {
       *had_selection = FALSE;
       return NULL;
@@ -6277,7 +6278,7 @@ get_selected_file_info_from_file_list (GtkFileChooserWidget *impl,
 
   *had_selection = TRUE;
 
-  info = _gtk_file_system_model_get_info (priv->browse_files_model, &iter);
+  info = _gtk_file_system_model_get_info (GTK_FILE_SYSTEM_MODEL (model), &iter);
   return info;
 }